package dk.cs.wolverine.client;

import java.util.List;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

import dk.cs.wolverine.client.TextList.ListType;

/**
 * This is a class implement Composite, which give us the flexibility to combine different widget, 
 * we are using our own custom TextList widget and a Label widget, to show a TextQuestion on the Overview page.
 * 
 * @author Siyalrach Anton Thomas
 */
public class HtmlList extends Composite{
	
	private TextList textList;
	private Label label;
	
	public HtmlList(ListType type, String header){
		textList = new TextList(type);
		label = new Label(header);
		VerticalPanel vp = new VerticalPanel();
		vp.add(label);
		vp.add(textList);
		initWidget(vp);
	}
	
	public void setHeader(String header){
		label.setText(header);
	}
	
	public void addItems(List<String> items){
		for(int i = 0; i < items.size(); i++){
			textList.addItem(items.get(i));
		}
	}
}
